package com.example.demosecuritycontext.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @GetMapping("/user/query")
    @PreAuthorize("hasAnyAuthority('query')")
    public String query() {
        return "query....";
    }

    @GetMapping("/user/delete")
    @PreAuthorize("hasAnyAuthority('delete')")
    public String delete() {
        return "delete....";
    }

    @GetMapping("/user/update")
    @PreAuthorize("hasAnyAuthority('update')")
    public String update() {
        return "update....";
    }

    @GetMapping("/user/insert")
    @PreAuthorize("hasAnyAuthority('insert')")
    public String insert() {
        return "insert....";
    }

    @GetMapping("/user/export")
    @PreAuthorize("hasAnyAuthority('export')")
    public String export() {
        return "export....";
    }
}
